<template>
  <div>
    <div class="hearder-form clearfix">
      <div class="search">
        <el-input
          placeholder="请输入内容"
          v-model="input3"
          size="medium"
          class="input-with-select"
        >
          <el-button slot="append" icon="el-icon-search"></el-button>
        </el-input>
      </div>
      <el-button-group class="btn-groups">
        <el-button type="primary" icon="el-icon-plus" size="small"
          >新增话题</el-button
        >
        <el-button type="primary" icon="el-icon-delete" size="small"
          >删除所选话题</el-button
        >
      </el-button-group>
    </div>
    <transition name="el-zoom-in-top">
      <div class="transition-box">
        <Qtable
          :tableData="tableData"
          :tableHead="tableHead"
          :toolBar="toolBar"
          :loading="loading"
          index
          stripe
          selection
          fixedSort="left"
          :footer="footer"
          @event="eventFn"
          @handler="handler"
          @selectHandle="handleSelect"
        >
        </Qtable>
      </div>
    </transition>
  </div>
</template>

<script>
import Qtable from "@/components/table/table";
import { tableHead, footer, toolBar } from "./js/table.js";
import httpApi from "@/api/httpApi";
export default {
  name: "bannerList",
  components: {
    Qtable
  },
  data() {
    return {
      input3: "",
      select: "",
      currentPage4: 1,
      tableHead: tableHead(),
      footer: footer(),
      toolBar: toolBar(),
      loading: false,
      tableData: [
        {
          id: "12987122",
          name: "好滋好味鸡蛋仔",
          category: "江浙小吃、小吃零食",
          desc:
            "荷兰优质淡奶，奶香浓而不腻荷兰优质淡奶，奶香浓而不腻荷兰优质淡奶，奶香浓而不腻荷兰优质淡奶，奶香浓而不腻荷兰优质淡奶，奶香浓而不腻荷兰优质淡奶，奶香浓而不腻荷兰优质淡奶，奶香浓而不腻",
          address: "上海市普陀区真北路",
          shop: "王小虎夫妻店",
          shopId: "10333"
        },
        {
          id: "12987123",
          name: "好滋好味鸡蛋仔",
          category: "江浙小吃、小吃零食",
          desc: "荷兰优质淡奶，奶香浓而不腻",
          address: "上海市普陀区真北路",
          shop: "王小虎夫妻店",
          shopId: "10333"
        },
        {
          id: "12987125",
          name: "好滋好味鸡蛋仔",
          category: "江浙小吃、小吃零食",
          desc: "荷兰优质淡奶，奶香浓而不腻",
          address: "上海市普陀区真北路",
          shop: "王小虎夫妻店",
          shopId: "10333"
        },
        {
          id: "12987126",
          name: "好滋好味鸡蛋仔",
          category: "江浙小吃、小吃零食",
          desc: "荷兰优质淡奶，奶香浓而不腻",
          address: "上海市普陀区真北路",
          shop: "王小虎夫妻店",
          shopId: "10333"
        }
      ]
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    filterHandler(value, row, column) {
      const property = column["property"];
      return row[property] === value;
    },
    handler() {},
    eventFn(obj) {
      console.log("---obj", obj);
      switch (obj.event) {
        //case 与 toolBar 内容一致 匹配后进行相关操作
        case "edit":
          // this.editAward(obj.row);
          //执行操作
          break;
        case "delete":
          // this.delAward(obj.row);
          //执行操作
          break;
      }
    },
    handleSelect() {},
    getData() {
      this.$http.get(httpApi.getViewPageList, {}).then(res => {
        console.log("轮播图列表", res);
      });
    }
  }
};
</script>

<style lang="less" scoped>
.hearder-form {
  background-color: #eef1f6;
  padding: 10px;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-right: 10px;
}

.el-input__inner {
  height: 36px;
  line-height: 36px;
}
.demo-table-expand {
  font-size: 0;
}

.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}

.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}
.search {
  margin-right: 20px;
}
</style>
